public class caeser { 
	public static void main(String [] args) {

		//the second argument is the number of steps to shift each charator
                int n = Integer.parseInt(args[1]);
                
                //caeser_cypher(Sting message , int n) returns the encriped message
                String encripted_message = caeser_cypher(args[0] , n);
                
                //print the output of caeser_cypher()
                System.out.println(encripted_message);
	}

        //shifts the first paramater n ascii charaters, based on the second paramater
        public static String caeser_cypher(String message , int n) {

		//use message as charactor array so it can be itterable
		char[] message_char = message.toCharArray();
 
                //String to contain encripted message
                String encripted_message = ""; 

                //for each charactor in message_char
                for(int i=0; i < message_char.length; i++) {
                        //append each cyphered charactor to the string
                	encripted_message += cypher_char(message_char[i], n);
                }

                return encripted_message;
       }

       //applys cypher to a single charactor, returns shifted charactor based on paramter n
       public static char cypher_char(char c, int n) {

                //only letters are encripted
                if ( !Character.isLetter(c)) {
                	return c;
		}

       		//charactor's position on the ascii chart 
                int ascii_position = (int)c;       
                //charactor alphebetical position
                int alpha_position;

                //flag denotes a lowercase charactor
		boolean is_lower;
                //maintaining case
                if(ascii_position >=97) {

                        //lowercase flag
	                is_lower = true;

                        //alphabetical position, where a = 1
        	        alpha_position = ascii_position - 96;
		}
                
		else {	

                        //lowercase flag
			is_lower = false;

                        //alphabetical position, where A = 1
        	        alpha_position = ascii_position - 64;
		}
		
		//new position (alphebetical)
		int new_position = (alpha_position + n) % 26;

		//specal case for z, because 26%26 = 0
		if (new_position == 0) {	

			new_position = 26;
		}
                
                //new ascii position
                int new_ascii_position = new_position + 64;

                //maintaining case
                if (is_lower) {

			new_ascii_position += 32;//shift to lowecase position on ascii chart
        	}

		//return as a charactor
		return (char)new_ascii_position;
	}
}
